#include "SceneController.h"


void SceneController::runScene(int nIdx)
{
    CCDirector::sharedDirector()->purgeCachedData();

	CCScene* scene;

    switch (nIdx)
    {
	case INTRO_SCENE:
		scene = IntroScene::create();
		break;
    case MENU_SCENE:
		scene = MenuScene::create();
		break;
	case GAME_SCENE:
		scene = GameScene::create();
		break;
	case RANK_SCENE:
		scene = RankScene::create();
    
    default:
        break;
    }
	
	if(scene == NULL)
	{
		return;
	}


	CCDirector * director = CCDirector::sharedDirector();
	if(director->getRunningScene())
	{
		director->replaceScene(scene);
	}
	else
	{
		director->runWithScene(scene);
	}

}